home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
wrnsr094
/
message.frm
< prev
next >
Wrap
Text File
|
1995-05-08
|
10KB
|
340 lines
VERSION 2.00
Begin Form Message
Caption = "Messages"
ClientHeight = 8310
ClientLeft = 165
ClientTop = 345
ClientWidth = 5085
Height = 8715
Icon = MESSAGE.FRX:0000
Left = 105
LinkMode = 1 'Source
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 8310
ScaleWidth = 5085
Top = 0
Width = 5205
Begin PictureBox List1
BackColor = &H000000FF&
Height = 1000
Left = 0
ScaleHeight = 975
ScaleWidth = 975
TabIndex = 2
Top = 0
Width = 1000
End
Begin ComboBox Combo1
BackColor = &H00C0FFC0&
Height = 300
Left = 480
TabIndex = 0
Text = "No Mail or News available"
Top = 120
Width = 4575
End
Begin PictureBox catchup_btn
Height = 495
Left = 0
Picture = MESSAGE.FRX:0302
ScaleHeight = 465
ScaleWidth = 465
TabIndex = 1
Top = 0
Width = 495
End
End
Function calc_usercode (ByVal userid$) As Integer
total! = 0
For i% = 1 To Len(userid$)
ch% = Asc(Mid$(userid$, i%, 1))
total! = total! + Int(ch% / 16) * 17 + (ch% Mod 16) * 23
Next i%
total! = total! Mod 32767
calc_usercode = total! - 1309
End Function
'
Sub catchup_btn_Click ()
If message.combo1.listcount = 0 Then
Unload edit
End
End If
Call clear_msg_list
If reading_mail Then
Kill mail_file$ + ".f"
Kill mail_file$ + ".i"
Else
If message.combo1.listindex <> -1 Then
Call make_dir(message.combo1.list(message.combo1.listindex), dir_name$)
Kill dir_name$ + "*.*"
End If
End If
cur_item = message.combo1.listindex
message.combo1.RemoveItem message.combo1.listindex
If cur_item < message.combo1.listcount Then
message.combo1.listindex = cur_item
Else
message.combo1.listindex = message.combo1.listcount - 1
End If
End Sub
Sub clear_msg_list ()
list1.visible = True
list1.empty = True
edit.message_text.Text = ""
End Sub
Sub Combo1_Click ()
Call clear_msg_list
If combo1.list(combo1.listindex) = "MAIL" Then
reading_mail = True
Call read_mail
Else
reading_mail = False
Call make_dir(combo1.list(combo1.listindex), dir_name$)
file_name$ = Dir$(dir_name$ + "*.*")
While (Len(file_name$) <> 0)
Call extract_param(dir_name$ + file_name$, "Subject", subj_line$)
If Len(subj_line$) = 0 Then
subj_line$ = "<None>"
End If
Call extract_param(dir_name$ + file_name$, "From", author$)
If Len(author$) <> 0 Then
If (InStr(author$, "(") <> 0) And (InStr(author$, ")") <> 0) Then
author$ = Mid$(author$, InStr(author$, "(") + 1)
author$ = Left$(author$, InStr(author$, ")") - 1)
End If
subj_line$ = subj_line$ + "; " + Chr$(9) + author$
End If
list1.AddItem file_name$ + ": " + subj_line$
file_name$ = Dir$
Wend
End If
If list1.listcount <> 0 Then
list1.topindex = 0
End If
End Sub
Sub Form_Load ()
new_line = Chr$(13) + Chr$(10)
Randomize
reply_written = False
If Len(Dir$("WRN.INI")) = 0 Then
MsgBox "WRN.INI not found in Current directory", 16, "Fatal Error"
End
End If
usenet_file$ = read_ini("UseNetFile")
news_dir$ = read_ini("NewsDir")
If Right$(news_dir$, 1) <> "\" Then
news_dir$ = news_dir$ + "\"
End If
msg_quote$ = read_ini("QuotePrefix")
static_file$ = read_ini("StaticFile")
user_id$ = read_ini("UserID")
registered = Val(read_ini("UserCode")) = calc_usercode(user_id$)
If Not registered Then
Select Case Int(Rnd * 4)
Case 0
nagbox.BTN_OK.caption = "Continue"
Case 1
nagbox.BTN_OK.caption = "Resume"
Case 2
nagbox.BTN_OK.caption = "Click"
Case Else
nagbox.BTN_OK.caption = "OK"
End Select
nagbox.Show
While nagbox.visible
dummy% = DoEvents()
Wend
End If
time_zone$ = read_ini("TimeZone")
site_name$ = read_ini("SiteID")
full_name$ = read_ini("UserName")
organisation$ = read_ini("Organisation")
out_path$ = read_ini("MailOutDir")
If Right$(out_path$, 1) <> "\" Then
out_path$ = out_path$ + "\"
End If
seq_path$ = read_ini("SeqFile")
out_news_list = read_ini("NewsOutList")
sign_filename = read_ini("SigFile")
news_reply$ = read_ini("NewsReply")
If Right$(news_reply$, 1) <> "\" Then
news_reply$ = news_reply$ + "\"
End If
uudecoder$ = read_ini("UUDecode")
batch_exe$ = read_ini("Batch")
Rem MsgBox "Finished with .INI, reading STATIC", 16, "Info"
Call extract_param(static_file$, "user", mail_file$)
Call change_chars("/", "\", mail_file$)
mail_file$ = mail_file$ + "\" + user_id$ + "\mailbox"
If Dir$(mail_file$ + ".f") <> "" Then
message.combo1.list(0) = "MAIL"
gcnt = 1
Else
gcnt = 0
End If
text_changed = 0
usenet_fileid = fopen(usenet_file$, "r")
file_contents$ = Input$(LOF(usenet_fileid), #usenet_fileid)
Close #usenet_fileid
If Len(Dir$(news_dir$ + "CONTROL\*.*")) <> 0 Then
Kill news_dir$ + "CONTROL\*.*"
End If
If Len(Dir$(news_dir$ + "MONITOR\*.*")) <> 0 Then
Kill news_dir$ + "MONITOR\*.*"
End If
prev_eol = 0
eol = InStr(file_contents$, Chr$(10))
While eol <> 0
join_line$ = Mid$(file_contents$, prev_eol + 1, eol - prev_eol - 2)
If Left$(join_line$, 1) <> "#" And UCase$(Left$(join_line$, 7)) <> "DEFAULT" Then
pos = InStr(UCase$(join_line$), "/DIR=")
If pos <> 0 Then
join_line$ = Mid$(join_line$, pos + 6)
join_line$ = Left$(join_line$, InStr(join_line$, Chr$(34)) - 1)
Else
pos = InStr(join_line$, " ")
tab_pos = InStr(join_line$, Chr$(9))
If (tab_pos <> 0 And tab_pos < pos) Or pos = 0 Then
pos = tab_pos
End If
If pos <> 0 Then
join_line$ = Left$(join_line$, pos - 1)
End If
End If
Call make_dir(join_line$, dir_name$)
If Len(Dir$(dir_name$ + "*.*")) <> 0 Then
message.combo1.list(gcnt) = join_line$
gcnt = gcnt + 1
End If
End If
prev_eol = eol
eol = InStr(eol + 1, file_contents$, Chr$(10))
Wend
If message.combo1.listcount = 0 Then
edit.Show 0
Else
message.Show 0
message.combo1.listindex = 0
End If
End Sub
Sub Form_Resize ()
list1.width = message.scalewidth
combo1.width = message.scalewidth - catchup_btn.width
list1.height = message.scaleheight - catchup_btn.height
End Sub
Sub Form_Unload (Cancel As Integer)
If reply_written Then
res = Shell(batch_exe, 1)
End If
End
End Sub
Sub List1_DblClick ()
If list1.listcount = 0 Then
catchup_btn.value = True
End If
If list1.listindex = -1 Then
list1.listindex = 0
End If
If combo1.list(combo1.listindex) = "MAIL" Then
reading_mail = True
msg_text$ = get_mail(list1.listindex)
subject$ = list1.list(list1.listindex)
Else
reading_mail = False
subject$ = list1.list(list1.listindex)
msg_filename$ = dir_name$ + Left$(subject$, InStr(subject$, ":") - 1)
subject$ = LTrim$(Mid$(subject$, InStr(subject$, ":") + 1))
If InStr(subject$, Chr$(9)) <> 0 Then
subject$ = Left$(subject$, InStr(subject$, Chr$(9)) - 2)
End If
msg_text$ = load_file(msg_filename$)
End If
Call